package hy.controller;

import hy.entity.Dept;
import hy.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class DeptCtrl_Provider {
    @Autowired
    DeptService service;
    @PostMapping("/dept/add")
    //@RequestParam:req.getParams();
    public boolean add(@RequestBody Dept d){
        return service.add(d);
    }
    @GetMapping("/dept/get/{id}")
    public Dept get(@PathVariable Integer id) throws InterruptedException {
        Thread.sleep(0000);
        return service.get(id);
    }

    @GetMapping("/dept/list")
    public List<Dept> get(){
        return service.list();
    }
}